<%-- 
    Document   : DetailCancelCar
    Created on : Nov 1, 2011, 11:45:01 PM
    Author     : Mr-aUgust
--%>

<%@page pageEncoding="UTF-8"%>
<%@ page session="true" import="java.util.Collection, DAL.*,java.sql.ResultSet;"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>East2West Tours and Travels</title>
       
        
        <script language="text/javascript" src="../js2/jquery.min.js"></script>       
        <script language="text/javascript" src="../js2/jquery.validate.min.js"></script>    
        <script type="text/javascript" src="../WebContent/jquery/jquery-1.3.2.js"></script>
        <script type="text/javascript" src="../WebContent/jquery/jquery.wysiwyg.js"></script>
        
        <script type="text/javascript">
	$(document).ready(function(){
	
			var form=$("#editTourPackage");		
					
			var nameTour=$("#nameTour");
			var nameTourInfor=$("#nameTourInfor");
			
			var duration=$("#duration");
			var durationInfor=$("#durationInfor");
			
			var adultprice=$("#adultprice");
			var adultpriceInfor=$("#adultpriceInfor");
			
			var childprice=$("#childprice");
			var childpriceInfor=$("#childpriceInfor");
                        
			var infor=$("#infor");
                        
			var message=$("#message");			
		
					
			nameTour.blur(validNameTour);
			nameTour.keyup(validNameTour);			
			duration.blur(validDuration);
			duration.keyup(validDuration);			
			adultprice.blur(validAdultprice);
			adultprice.keyup(validAdultprice);			
			childprice.blur(validChildprice);
			childprice.keyup(validChildprice);
                         infor.blur(validInforTour);
                        infor.keyup(validInforTour);
			message.blur(validMessage);
			message.keyup(validMessage);

			
				form.submit(function(){
					if(validNameTour() & validDuration() & validAdultprice() & validChildprice() & validInforTour() & validMessage()){
						return true;
					}
					else{
						return false;

					}
			 });
				
				
				function validNameTour(){
				  if(nameTour.val()==""){
						nameTour.addClass("error");
						nameTourInfor.text("Enter tour name");
						nameTourInfor.addClass("error");
						return false;
					}
					else
					{
					    nameTour.removeClass("error");
						nameTourInfor.text("");
						nameTourInfor.removeClass("error");
						return true;
					}
				
				}
				function validDuration(){
					 if(duration.val()==""){
						duration.addClass("error");
						durationInfor.text("Please enter Duration");
						durationInfor.addClass("error");
						return false;
					}
					else{
					    duration.removeClass("error");
						durationInfor.text("");
						durationInfor.removeClass("error");
						return true;
					}
				}
				
				function validAdultprice(){
				  if(adultprice.val()==""){
						adultprice.addClass("error");
						adultpriceInfor.text("Please enter price Adult : example : 1200");
						adultpriceInfor.addClass("error");
						return false;
					}
					else if(isNaN(adultprice.val()))
					{
					   adultprice.addClass("error");
						adultpriceInfor.text("Please enter is number");
						adultpriceInfor.addClass("error");
						return false;
					}
					else{
					    adultprice.removeClass("error");
						adultpriceInfor.text("");
						adultpriceInfor.removeClass("error");
						return true;
					}
				
				}
				
				function validChildprice(){
				  if(childprice.val()==""){
						childprice.addClass("error");
						childpriceInfor.text("Please enter price child : example : 1200");
						childpriceInfor.addClass("error");
						return false;
					}
					else if(isNaN(childprice.val()))
					{
					   childprice.addClass("error");
						childpriceInfor.text("Please enter is number");
						childpriceInfor.addClass("error");
						return false;
					}
					
					else{
					    childprice.removeClass("error");
						childpriceInfor.text("");
						childpriceInfor.removeClass("error");
						return true;
					}
				
				}
                                 function validInforTour(){
				  if(infor.val()==""){
						infor.addClass("error");
						
						return false;
					}
					else
					{
					    infor.removeClass("error");
						
						return true;
					}
				
				}
                                
				function validMessage(){
				  if(message.val()==""){
						message.addClass("error");
						
						return false;
					}
					else{
					    message.removeClass("error");
						
						return true;
					}
				
				}
			
	  });
        </script>         
    </head>
    <script type="text/javascript">      
 $(function()
        {
        $("#message").wysiwyg();
        });
    </script>
    <style type="text/css">
        #editTourPackage input.error{
        background: #f8dbdb;
        border-color: #e77776;
        }
        
        #editTourPackage input{
        width: 210px;
        
        font-family:Times New Roman, Arial,  Verdana, Helvetica, sans-serif;	
        }
        
        #editTourPackage span{
        margin-left: 10px;
        color: #6f9ff1;
        font-size: 11px;
        font-style: italic;
        }
        #editTourPackage span.error{
        color: #e46c6e;
        }
        
        #editTourPackage textarea.error{
        background: #f8dbdb;
        border-color: #e77776;
        }
        
        
        #editTourPackage #update{
        background: #6f9ff1;
        color: #fff;
        font-weight: 700;
        font-style: normal;
        border: 0;
        cursor: pointer;
        }
        #editTourPackage #reset{
        background: #6f9ff1;
        color: #fff;
        font-weight: 700;
        font-style: normal;
        border: 0;
        cursor: pointer;
        }
        .style2 {color: #3399FF;
        text-align:left;
        }
    </style>
    
    
    
    
    <body>
        <center>
            <form id="editTourPackage" name="editTourPackage" method="post" action="../ControllerUpTourPackage">
                <table width="700px"> 
                    <%
                    String tid="";
                    String name="";
                    String tadult="";
                    String tchild="";
                    String durn="";
                    String desn="";
                    String state="";
                    
                    ResultSet rs=(ResultSet)session.getAttribute("listTourPack");
                    while(rs.next()) {
                        tid=rs.getString("TourID");
                        name=rs.getString("TourName");
                        durn=rs.getString("Duration");
                        tadult=rs.getString("Adultprice");
                        tchild=rs.getString("Childprice");
                        desn=rs.getString("Description");
                        state=rs.getString("State");
                    %>
                    <tr>
                        <td height="30px"></td>
                        <td height="30px"></td>
                    </tr>
                    
                    <tr>
                        <td></td>
                        <td align="left"><h2 class="style2">Edit Tour Package</h2></td>
                    </tr>
                    <tr>
                        <td height="20px"></td>
                        <td height="20px"></td>
                    </tr>
                    <tr>
                        
                        <td align="left">TourID</td>
                        <td align="left"><input  type="text" id="tourId" name="tourId" readonly="true" value="<%=tid%>"/></td>
                        
                    </tr>
                    <tr>
                        <td align="left">Tour name</td>
                        <td align="left"><input  type="text" id="nameTour" name="nameTour" value="<%=name%>"/>
                        <span id="nameTourInfor">What's tour name ?</span>	
                    </td>
                    </tr>
                    <tr>
                        <td align="left">Duration tour</td>
                        <td align="left"><input  type="text" id="duration" name="duration" value="<%=durn%>"/>
                            
                        <span id="durationInfor">Please choose canlendar </span>	
                    </td>
                    </tr>
                    <tr>
                        <td align="left"> Adult price </td>
                        <td align="left"><input  type="text" id="adultprice" name="adultprice" value="<%=tadult%>"/>
                        <span id="adultpriceInfor">Please input pirce, exam : 200</span>		</td>
                    </tr>
                    <tr>
                        <td align="left">Child price</td>
                        <td align="left"><input  type="text" id="childprice" name="childprice" value="<%=tchild%>"/>
                            <span id="childpriceInfor">Please input pirce, exam : 200</span>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">Information for tour </td>
                        <td>  <textarea id="infor" name="infor" cols="58" rows="7"><%=state%></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">More description(*) </td>
                        <td>  <textarea id="message" name="message" cols="85" rows="17"><%=desn%></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center"><input id="update" name="update" type="submit" value="Update"/>
                        <input id="reset" name="reset" type="reset" value="reset" />	
                    </td>
                    </tr>     
                    <%
                    }
                    %>
                </table>               			
                
            </form>
            
        </center>
    </body>
    
    <link rel="stylesheet" href="../WebContent/css/jquery.wysiwyg.css" type="text/css" />       
    
</html>
